<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>xSite Administrator's Control Panel</title>
<link rel="stylesheet" href="./php.net.cn/xsite/admin/images/admincp.css" type="text/css" media="all" />
<meta content="xSite Inc." name="Copyright" />

<script type="text/javascript" src="php.net.cn/xsite/skin/jq/jquery.js"></script>
<script type="text/javascript" src="php.net.cn/xsite/tool/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="php.net.cn/xsite/tool/ckfinder/ckfinder.js"></script>

</head>
<body>
<div id="append"></div>
<script type="text/javascript">
	function headermenu(ctrl) {
		ctrl.className = ctrl.className == 'otherson' ? 'othersoff' : 'otherson';
		var menu = document.getElementById('header_menu_body');
		if(!menu) {
			menu = document.createElement('div');
			menu.id = 'header_menu_body';
			menu.innerHTML = '<ul>' + document.getElementById('header_menu_menu').innerHTML + '</ul>';
			var obj = ctrl;
			var x = ctrl.offsetLeft;
			var y = ctrl.offsetTop;
			while((obj = obj.offsetParent) != null) {
				x += obj.offsetLeft;
				y += obj.offsetTop;
			}
			menu.style.left = x + 'px';
			menu.style.top = y + ctrl.offsetHeight + 'px';
			menu.className = 'togglemenu';
			menu.style.display = '';
			document.body.appendChild(menu);
		} else {
			menu.style.display = menu.style.display == 'none' ? '' : 'none';
		}
	}
</script>


<script type="text/javascript">
	function select_category() {
		 var category_list = document.getElementById("category_list");
		  window.location = category_list.options[category_list.selectedIndex].value;
	}
	
</script>


<div class="container">

	<h3 class="marginbot">		
		<select name="category_list" onchange="select_category()" id="category_list">
		<option value="xsite.php?action=product&operation=list" >全部分类</option>
		<?php foreach($system_tree_category as $k => $v) {?>
				<?php if($v['module'] == 'product') {?> 
                	<option value="xsite.php?action=product&operation=list&category=<?=$k?>" <?php if(!empty($category) && $category == $k){?>selected="selected"<?php }?> ><?=$v['name']?></option>
					<?php if(is_array($v['subcategory']) && count($v['subcategory'])) foreach($v['subcategory'] as $kk => $vv){?>
                            <?php if($vv['module'] == 'product') {?> 
                            	<option value="xsite.php?action=product&operation=list&category=<?=$kk?>" <?php if(!empty($category) && $category == $kk){?>selected="selected"<?php }?> >&nbsp;&nbsp;|----<?=$vv['name']?></option>
								<?php if(is_array($vv['subcategory']) && count($vv['subcategory'])) foreach($vv['subcategory'] as $kkk => $vvv){?>
                                    <option value="xsite.php?action=product&operation=list&category=<?=$kkk?>" <?php if(!empty($category) && $category == $kkk){?>selected="selected"<?php }?> >&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;|----<?=$vvv['name']?></option>
                                <?php }?>
                            <?php }?>
                    <?php }?>
                <?php } ?>
		<?php }?>
		</select>
		
		<a href="xsite.php?action=product&operation=list&category=<?=$category?>" class="sgbtn"><span>返回列表</span></a> 
	</h3>
	
  <div class="note fixwidthdec">
    <p class="i">产品信息编辑或添加。</p>
  </div>
  
  
  <div class="mainbox nomargin">
    <form name="form1" method="post" enctype="multipart/form-data" action="xsite.php?action=product&operation=edit&category=<?=$category?>&page=<?=$page?>">
	
	<?php if (empty($category)) {?>
	请选择发布分类：
	  <label>
	  <select name="category" id="category">
		<?php foreach($system_tree_category as $k => $v) {?>
				<?php if($v['module'] == 'product') {?> 
                	<option value="<?=$k?>" <?php if(!empty($category) && $category == $k){?>selected="selected"<?php }?> ><?=$v['name']?></option>
					<?php if(is_array($v['subcategory']) && count($v['subcategory'])) foreach($v['subcategory'] as $kk => $vv){?>
                            <?php if($vv['module'] == 'product') {?> 
                            	<option value="<?=$kk?>" <?php if(!empty($category) && $category == $kk){?>selected="selected"<?php }?> >&nbsp;&nbsp;|----<?=$vv['name']?></option>
								<?php if(is_array($vv['subcategory']) && count($vv['subcategory'])) foreach($vv['subcategory'] as $kkk => $vvv){?>
                                    <option value="<?=$kkk?>" <?php if(!empty($category) && $category == $kkk){?>selected="selected"<?php }?> >&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;|----<?=$vvv['name']?></option>
                                <?php }?>
                            <?php }?>
                    <?php }?>
                <?php } ?>
		<?php }?>
      </select>
	  </label>
	<?php }?>

	<table class="opt"><?=dynamic_form($content, "list")?></table>
		
	<table class="opt">
        <tr>
          <th>上传产品相关图片</th>
        </tr>
        <?php for($i = 1; $i <= 8 ; $i++){?>
		<tr>
          <td><label id='form_product_pic_<?=$i?>'><span>上传第<?=$i?>张产品图片：</span><input name='product_pic[]' class='uploadbtn marginbot' type='file' id='product_pic_<?=$i?>' value='' /></label> </td>
        </tr>
		<?php }?>
		<tr>
          <td>
          请勾选要删除的图片:<br />
          <?php if(isset($product_info['product_pic']) && is_array($product_info['product_pic']) && count($product_info['product_pic']) ) foreach($product_info['product_pic'] as $k => $v) {?>
          		<?php if(!empty($v)) {?>
                			<span style="float:left; margin:2px; text-align:center; margin-top:4px"><a href="<?=$v?>" target="_blank"><img src="<?=$v?>" border="0" width="80" height="80" /></a> <br /><input style="margin-top:3px" name="product_pic_del[]" type="checkbox" id="product_pic_del[]" value="<?=$k?>" /></span>
                
                <?php }?>
          <?php }?>
          
          <!--现有图片信息 -->
          <?php if(isset($product_info['product_pic']) && is_array($product_info['product_pic']) && count($product_info['product_pic']) ) foreach($product_info['product_pic'] as $k => $v) {?>
          		<?php if(!empty($v)) {?>
                			<input name='data[product_pic][<?=$k?>]' type='hidden' value='<?=$v?>' />
                
                <?php }?>
          <?php }?>
          
          
          
          </td>
        </tr>
	</table>
	
	<h3>SEO设置</h3>
	<table class="inputlist"><?=dynamic_form($seo)?></table>
	
	
      <div class="opt">
        <input type="submit" name="dosubmit" value=" 提 交 " class="btn" tabindex="3" />
      </div>
  </form>
  </div>
</div>


<script type="text/javascript">
//<![CDATA[

var editor_status = 0;

var editor = null;

function close_editor() {
	if (editor_status != 1) {
		return false;
	}
	
	editor.destroy();
	editor_status = 0;
}

function create_editor(div){
	
	if (editor_status != 0) {
		return false;
	}
	
	window.editor = CKEDITOR.replace( div,
	{
		height:'400px',
		width:'600px',
		
	});
	CKFinder.setupCKEditor( editor, { basePath : '<?=SITE_PATH?>/php.net.cn/xsite/tool/ckfinder/', rememberLastFolder : false });
	
	editor_status = 1;
}

<?php if(isset($auto_start_editor) && $auto_start_editor != 4){?>
create_editor('content');
<?php }?>


//]]>
</script>


</body>
</html>
